<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name')->comment('用户名');
            $table->string('phone')->unique();
            $table->string('password');
            $table->string('avatar_url')->nullable()->comment('用户头像url');
            $table->unsignedDecimal('reference_amount',30,6)->default(0)->comment('推荐奖励==分享');
            $table->unsignedDecimal('shop_amount',30,6)->default(0)->comment('商城金额');
            $table->nestedSet(); //
            $table->string('ref_code')->unique()->comment('邀请码');
            $table->string('asset_password')->nullable()->comment('资金密码');
            $table->boolean('is_baned')->default(0)->comment('true 锁 | false 解锁 ');
            $table->string('reg_ip')->comment('注册IP');
            $table->string('login_ip')->nullable()->comment('登录IP');
            $table->string('baned_reason')->nullable()->comment('冻结原因');
            $table->boolean(' is_disable_trade')->default(0)->comment('0 正常| 1 出局不推荐人盈利3000出局 不让发起、提现');
            $table->string('wechat_code')->nullable()->comment('微信号');
            $table->string('wechat_qrcode_url')->nullable()->comment('微信号二维码');
            $table->string('bank_card')->nullable()->comment('银行卡');
            $table->string('real_name')->nullable()->comment('真实姓名');
            $table->string('bank_name')->nullable()->comment('银行名称');
            $table->unsignedBigInteger('created_at')->comment('用户创建时间');
            $table->unsignedBigInteger('updated_at')->comment('用户创建时间');
            $table->unsignedBigInteger('login_at')->nullable()->comment('上次 登录时间');

            $table->rememberToken();

        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('users');
    }
}
